﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using DuAnNH.Fd_class;

namespace DuAnNH
{
    public partial class Frm_TKe : Form
    {
        public Frm_TKe()
        {
            InitializeComponent();
        }

        private void Frm_TKe_Load(object sender, EventArgs e)
        {

        }
        public void Tk_ngay()
        {
            DataTable tb = new DataTable();
            tb = CLs_ThongKe.LayDSTK_Ngay(cbb_day.Text);
            dtgv_ThongKe.DataSource = tb;
        }
        public void Tk_thang()
        {
            DataTable tb = new DataTable();
            tb = CLs_ThongKe.LayDSTK_Thang(cbb_month.Text,txt_year.Text);
            dtgv_ThongKe.DataSource = tb;
        }
        public void Tk_khoangngay()
        {
            DataTable tb = new DataTable();
            tb = CLs_ThongKe.LayDSTK_KhoangNgay(cbb_day_begin.Text,cbb_day_end.Text);
            dtgv_ThongKe.DataSource = tb;
        }

        private void btt_tk_day_Click(object sender, EventArgs e)
        {
            Tk_ngay();
        }

        private void btt_tk_month_Click(object sender, EventArgs e)
        {
            Tk_thang();
        }

        private void btt_tk_daytoday_Click(object sender, EventArgs e)
        {
            Tk_khoangngay();
        }

        private void cbb_month_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!Char.IsDigit(e.KeyChar) && !Char.IsControl(e.KeyChar))
            {
                e.Handled = true;
            }
        }

        private void txt_year_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!Char.IsDigit(e.KeyChar) && !Char.IsControl(e.KeyChar))
            {
                e.Handled = true;
            }
        }
    }
}
